#include "mainwindow.h"

#include <QApplication>
#include <QDir>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    char cBuff[STR_BUFF_LEN] = {0};
    QString appPath = QCoreApplication::applicationDirPath();

    sprintf(cBuff,"%s/log",appPath.toStdString().c_str());
    QDir curDir(appPath);
    curDir.mkdir(cBuff);
    //init log system,
    strcat(cBuff,"/mpplog.txt");

    elog_init(cBuff);


    elog_set_fmt(ELOG_LVL_ASSERT, ELOG_FMT_ALL);
    elog_set_fmt(ELOG_LVL_ERROR, ELOG_FMT_LVL | ELOG_FMT_TAG | ELOG_FMT_TIME);
    elog_set_fmt(ELOG_LVL_WARN, ELOG_FMT_LVL | ELOG_FMT_TAG | ELOG_FMT_TIME);
    elog_set_fmt(ELOG_LVL_INFO, ELOG_FMT_LVL | ELOG_FMT_TAG | ELOG_FMT_TIME);
    elog_set_fmt(ELOG_LVL_DEBUG, ELOG_FMT_ALL & ~ELOG_FMT_FUNC);
    elog_start();

    log_i("ldtercom is start");

    MainWindow w;
    w.show();
    return a.exec();
}
